import networkx as nx
import matplotlib.pyplot as plt
import random
__author__ = 'pstalidis'
from SocialChurning.SpreadActivation import SpreadActivation, CommunityActivation

A = nx.gnm_random_graph(random.randint(100, 200), random.randint(1000, 2000), directed=True)
for (n1, n2) in A.edges_iter():
    A.edge[n1][n2]["strength"] = random.randrange(100, 500)*0.01
R = CommunityActivation(A, strength="strength")

for node in A.nodes_iter():
    print len(A.neighbors(node)), A.degree(node), A.in_degree(node, weight="strength"), A.out_degree(node, weight="strength")

nx.eigenvector_centrality(A)

r = nx.betweenness_centrality(A)

